﻿using System;
using Adp.Common;
using Yqd.Models;

namespace Yqd.Core
{
    public class TaskLogService
    {

        public static int AddLog(long TaskID, string Content, bool IsJb = false, bool IsTt = true)
        {
            var ctx = Fn.GetService<YqdContext>();
            var model = new Yqd_TaskLog();
            model.EmployeeCode = "GE_f27276c87bdb4f0ca3c4aff767a40751";
            var l = WxUser.LogonInfo;
            if (l != null)
            {
                if (IsTt) Content = l.UnitName + "(" + l.Name + ")" + Content;
                model.EmployeeCode = WxUser.LogonInfo.EmployeeCode;
            }
            model.TaskID = TaskID;
            model.Content = Content;
            model.IsJb = IsJb;
            model.Instime = DateTime.Now;
            ctx.Yqd_TaskLog.Add(model);
            return ctx.SaveChanges();
        }
    }
}
